﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Reflection;

namespace Summerset.Isbndb.Publishers
{

    /// <summary>
    /// The 'publishers' collection provides information about book publishers. 
    /// </summary>
    public static class PublishersArgs
    {

        /// <summary>
        /// Gets an array of strings containing the valid indexes for the publishers collection.
        /// </summary>
        public static string[] GetValidIndexArguments()
        {

            return typeof(Arguments)
                .GetFields(BindingFlags.Public | BindingFlags.Static)
                .Select(fi => fi.GetRawConstantValue().ToString())
                .ToArray();

        }

        /// <summary>
        /// Gets an array of strings that contain the additional results that can be requested from the publishers collection.
        /// </summary> 
        public static string[] GetValidResultArguments()
        {

            return typeof(Results)
                .GetFields(BindingFlags.Public | BindingFlags.Static)
                .Select(fi => fi.GetRawConstantValue().ToString())
                .ToArray();

        }


        /// <summary>
        /// Contains the possible indexes that can be queried from the publishers collection.
        /// One of these constants must be provided to the <see cref="PublishersRequest"/> constructor.
        /// </summary>
        public static class Arguments
        {
            /// <summary>
            /// Performs a search on the publisher name.
            /// </summary>
            /// <remarks>
            /// The search follows the same rules and syntax as the search on the website itself -- 
            /// you can group words together using double quotes, all non-ignored words must be present in the results.
            /// </remarks>
            public const string name = "name";

            /// <summary>
            /// Retrieving publisher data by ISBNdb.com's publisher ID. Returns at most one match. 
            /// </summary>
            public const string publisher_id = "publisher_id";

        }

        /// <summary>
        /// Contains optional arguments that can be provided to the <see cref="PublishersRequest"/> constructor.        
        /// </summary>
        public static class Results
        {
            /// <summary>
            /// Shows some details about publisher. 
            /// </summary>
            public const string details = "details";

            /// <summary>
            /// Shows a list of categories this publisher is listed in. Typically, this shows only one category where publishers are listed alphabetically.
            /// </summary>
            public const string categories = "categories";
        }

    }
}
